
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author leehoa
 */
public class checkTimeZone {
    
    public static void main(String [] agr){
//        String[] validIDs = TimeZone.getAvailableIDs();
//        for (String str : validIDs) {
////              if(str != null && str.equals("yourString"))
////              {
//                System.out.println("Valid ID: "+str);
////              }
//        }
//        Date date = new Date();
//        Date date2 = new Date(date.toGMTString() +" +7:00");
//        System.out.println(date.toGMTString());
//        System.out.println(date2.toGMTString());
        System.out.println("date time: "+getTimeZone("GMT+8"));
        
        
        Date date = new Date();
        SimpleDateFormat simpDate;
        simpDate = new SimpleDateFormat("kk:mm");
        System.out.println("today: "+simpDate.format(date)); 
        
        simpDate.setTimeZone(TimeZone.getTimeZone("GMT"));
        System.out.println("GMT : "+simpDate.format(date));
        
        simpDate.setTimeZone(TimeZone.getTimeZone("GMT+7"));
        System.out.println("GMT+7 : "+simpDate.format(date));
        
        simpDate.setTimeZone(TimeZone.getTimeZone("GMT+8"));
        System.out.println("GMT+8 : "+simpDate.format(date));
        
        final Date currentTime = new Date();        
        final SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
//                new SimpleDateFormat("EEE, MMM d, yyyy hh:mm:ss a z");

        System.out.println("currentTime.: "+ currentTime.toLocaleString());
                
        // Give it to me in US-Pacific time.
        sdf.setTimeZone(TimeZone.getTimeZone("America/Los_Angeles"));
        System.out.println("LA time: " + sdf.format(currentTime));

        // Give it to me in GMT-0 time.
        sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
        System.out.println("GMT time: " + sdf.format(currentTime));

        // Or maybe Zagreb local time.
        sdf.setTimeZone(TimeZone.getTimeZone("Europe/Zagreb"));
        System.out.println("Zagreb time: " + sdf.format(currentTime));

        // Even 10 hours and 10 minutes ahead of GMT
        sdf.setTimeZone(TimeZone.getTimeZone("GMT-0010"));
        System.out.println("0010 ahead time: " + sdf.format(currentTime));                
        
        // Give it to me in GMT+8:00 time.
        sdf.setTimeZone(TimeZone.getTimeZone("GMT+5:30"));
        System.out.println("GMT+5:30: " + sdf.format(currentTime)); 
        Date newdate = new Date(sdf.format(currentTime));
        System.out.println(": "+newdate.toString());
    }
    
    public static String getTimeZone(String timezone){
        Date today = new Date();
        SimpleDateFormat simple = new SimpleDateFormat("dd-MM-yyyy kk:mm");
        simple.setTimeZone(TimeZone.getTimeZone(timezone));
        String time = simple.format(today);
        return time;
    }    
    
}
